<layout name="layout" />
<script src="http://simba.shelpe.com/Js/dist/date.js?_v=4.01"></script>
<script src="//cdn.bootcss.com/bootstrap-daterangepicker/2.1.24/daterangepicker.min.js"></script>
<script src="//cdn.bootcss.com/bootstrap-datetimepicker/2.1.30/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
<div>
	<form class="form-inline" role="form" action="/adgroup/index" mothed="get" id="search_form">
		<div class="input-group ">
			<span class="input-group-addon">用户名</span>
			<input type="text" class="form-control" placeholder="用户名" autocomplete="off" name="search[nick]" value="{$nick}"/>
		</div>
		<div class="input-group ">
			<span class="input-group-addon">时间</span>
			<input type="text" class="form-control" id="daterange" autocomplete="off" />
			<input type="hidden" id="from" name="search[from]" value="" />
			<input type="hidden" id="to" name="search[to]" value="" />
		</div>
		<input type="hidden" id="search-order" name="order" value="{$order}" />
		<input type="hidden" id="search-asc" name="asc" value="{$asc}" />
		<button type="submit" class="btn btn-default">查询</button>
	</form>
</div>
<div style="margin-top:20px;">
	<table class="table total" id="total">
		<thead>
			<tr>
				<th width="10%">用户总数</th>
				<th width="10%">云智投推广计划总数</th>
				<th width="10%">云智投自动推广计划总数</th>
				<th width="10%">云智投无线养分推广计划总数</th>
				<th width="10%">思路总数</th>
				<th width="10%">通用思路数</th>
				<th width="10%">定制思路数</th>
				<th width="10%">思路使用数</th>
				<th width="10%">卡位策略总数</th>
				<th width="10%">开启中的卡位策略数</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td class="v">{$total['total_user_num']}</td>
				<td class="v">{$total['total_campaign_num']}</td>
				<td class="v">{$total['total_campaign_auto_num']}</td>
				<td class="v">{$total['total_campaign_wireless_num']}</td>
				<td class="v">{$total['total_sem_num']}</td>
				<td class="v">{$total['total_sem_public_num']}</td>
				<td class="v">{$total['total_sem_custom_num']}</td>
				<td class="v">{$total['total_sem_use_num']}</td>
				<td class="v">{$total['total_kawei_num']}</td>
				<td class="v">{$total['total_kawei_use_num']}</td>
			</tr>
		</tbody>
	</table>
	<table class="table">
		<thead>
			<tr>
				<th width="10%"><a href="javascript:;">用户名</a></th>
				<th width="10%" class="setOrder <if condition="$order eq 'cam_num'"><if condition="$asc eq 'DESC'">search-DESC<else/>search-ASC</if></if>" data-order="cam_num" data-order-asc="DESC"><a href="javascript:;">云智投推广计划总数</th>
				<th width="10%" class="setOrder <if condition="$order eq 'auto_cam_num'"><if condition="$asc eq 'DESC'">search-DESC<else/>search-ASC</if></if>" data-order="auto_cam_num" data-order-asc="DESC"><a href="javascript:;">云智投自动推广计划总数</a></th>
				<th width="10%" class="setOrder <if condition="$order eq 'wireless_cam_num'"><if condition="$asc eq 'DESC'">search-DESC<else/>search-ASC</if></if>" data-order="wireless_cam_num" data-order-asc="DESC"><a href="javascript:;">云智投无线养分推广计划总数</a></th>
				<th width="10%" class="setOrder <if condition="$order eq 'sem_total_num'"><if condition="$asc eq 'DESC'">search-DESC<else/>search-ASC</if></if>" data-order="sem_total_num" data-order-asc="DESC"><a href="javascript:;">思路总数</a></th>
				<th width="10%" class="setOrder <if condition="$order eq 'sem_public_num'"><if condition="$asc eq 'DESC'">search-DESC<else/>search-ASC</if></if>" data-order="sem_public_num" data-order-asc="DESC"><a href="javascript:;">通用思路数</a></th>
				<th width="10%" class="setOrder <if condition="$order eq 'sem_custom_num'"><if condition="$asc eq 'DESC'">search-DESC<else/>search-ASC</if></if>" data-order="sem_custom_num" data-order-asc="DESC"><a href="javascript:;">定制思路数</a></th>
				<th width="10%" class="setOrder <if condition="$order eq 'sem_use_num'"><if condition="$asc eq 'DESC'">search-DESC<else/>search-ASC</if></if>" data-order="sem_use_num" data-order-asc="DESC"><a href="javascript:;">思路使用数</a></th>
				<th width="10%" class="setOrder <if condition="$order eq 'kawei_total_num'"><if condition="$asc eq 'DESC'">search-DESC<else/>search-ASC</if></if>" data-order="kawei_total_num" data-order-asc="DESC"><a href="javascript:;">卡位策略总数</a></th>
				<th width="10%" class="setOrder <if condition="$order eq 'kawei_use_num'"><if condition="$asc eq 'DESC'">search-DESC<else/>search-ASC</if></if>" data-order="kawei_use_num" data-order-asc="DESC"><a href="javascript:;">开启中的卡位策略数</a></th>
			</tr>
		</thead>
		<tbody>
			<foreach name="users" item="user">
			<tr>
				<td>{$user['nick']}</td>
				<td>{$user['cam_num']}</td>
				<td>{$user['auto_cam_num']}</td>
				<td>{$user['wireless_cam_num']}</td>
				<td>{$user['sem_total_num']}</td>
				<td>{$user['sem_public_num']}</td>
				<td>{$user['sem_custom_num']}</td>
				<td>{$user['sem_use_num']}</td>
				<td>{$user['kawei_total_num']}</td>
				<td>{$user['kawei_use_num']}</td>
			</tr>
			</foreach>
		</tbody>
	</table>
</div>
<if condition="$totalPage != 0">
<div class="page-content">
	<nav>
		<ul class="pagination">
			<if condition="$currentPage != 1">
			<li class=""><a href="/adgroup/index?page={$lastPage}{$current_search}">&laquo;</a></li>
			<else/>
			<li class="disabled"><a href="javascript:;">&laquo;</a></li>
			</if>
			<for start="1" end="$totalPage+1">
			<li class="<if condition="$currentPage == $i">active</if>"><a href="<if condition="$currentPage == $i">javascript:;<else/>/adgroup/index?page={$i}{$current_search}</if>">{$i}</a></li>
			</for>
			<if condition="$currentPage != $totalPage">
			<li class=""><a href="/adgroup/index?page={$nextPage}{$current_search}">&raquo;</a></li>
			<else/>
			<li class="disabled"><a href="javascript:;">&raquo;</a></li>
			</if>
		</ul>
	</nav>
</div>
</if>
<script>
	var from = '{$dateTime['from']}',
		to = '{$dateTime['to']}';
	$('#daterange').daterangepicker({
		startDate : new Date(from),
		endDate : new Date(to),
		maxDate : Date.today().add({ days: -1 }),
		separator: ' 到 ',
		ranges: {
			'昨天': [Date.today().add({ days: -1 }), Date.today().add({ days: -1 })],
			'最近三天': [Date.today().add({ days: -3 }), Date.today().add({ days: -1 })],
			'最近一周': [Date.today().add({ days: -7 }), Date.today().add({ days: -1 })],
			'最近半个月': [Date.today().add({ days: -15 }), Date.today().add({ days: -1 })],
			'最近一个月': [Date.today().add({ days: -30 }), Date.today().add({ days: -1 })],
			'最近三个月': [Date.today().add({ days: -90 }), Date.today().add({ days: -1 })]
		},
		locale: {
			applyLabel : '确定',
			clearLabel : '关闭',
			fromLabel: '从',
			toLabel: '到 ',
			customRangeLabel: '自定义时间',
			firstDay: 1
		},
		format: 'YYYY-MM-DD'
	}, function(start, end, label) {
		$('#from').val(start.format('YYYY-MM-DD'));
		$('#to').val(end.format('YYYY-MM-DD'));
	});
</script>